{include file="public/head"/}
<style>
    /* 打开宽度限制 */
    .popover {
        max-width: 90vw;
    }
</style>
<div id="chequeuser">
    <div class="container-fluid">

        <div class="row clearfix">
            <div class="col-md-12 column">
                <div class="alert alert-dismissable alert-info" id="headeralert">
                    <button type="button" class="close">×</button>
                    <p></p>
                </div>
            </div>
        </div>


        <div class="ntDesktop">
            <div class="ntDesktop-head">支票管理界面</div>

            <div class="row" style="padding-top:0px">
                <div class="col-md-6">
                    <ul class="nav nav-tabs">
                        <li @click="changestatus(1)" class="active"><a href="#new" data-toggle="tab">
                            新支票<span class="label label-info">{{countnum.countnumone}}</span></a>
                        </li>
                        <li @click="changestatus(2)"><a href="#checkin" data-toggle="tab">
                            已存入<span class="label label-default">{{countnum.countnumtwo}}</span></a>
                        </li>
                        <li @click="changestatus(3)"><a href="#used" data-toggle="tab">
                            已使用<span class="label label-default">{{countnum.countnumthree}}</span></a>
                        </li>
                    </ul>
                </div>
                <div class="col-md-6 text-right" v-if="status==1">
                    <button class="btn btn-primary" data-toggle="modal" @click="openRUcang(1)">批量存入账户</button>
                    <button class="btn btn-primary" data-toggle="modal"  @click="openRUcang(2)">批量使用</button>
                </div>
            </div>

            <div class="row tab-content" style="padding-top: 1rem">
                <!-- 新支票 -->
                <div class="tab-pane active" id="new">
                    <div class="col-md-12">
                        <table class="table table-striped table-hover ntTable">
                            <thead>
                            <tr>
                                <th class="text-center"><input type="checkbox" @click="allsel"></th>
                                <th width="4%"> 订单号 </th>
                                <th class="sorting"> 公司 </th>
                                <th> 业务员 </th>
                                <th> 编辑 </th>
                                <th> 支票 </th>
                                <th class="sorting"> 金额 </th>
                                <th class="sorting" >付款日期</th>
                                <th> 签收 </th>
                                <th> 操作 </th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr v-for="item in list" :key="item.id">
                                <td align="center"><input type="checkbox" @click="onesel(item.id,item.amount)"></td>
                                <td><span v-if="item.sale_id">{{formatUnit(item.sale_id,'ID')}}</span></td>
                                <td><span v-if="item.sale_id">{{item.company_name}}</span></td>
                                <td><span v-if="item.sale_id">{{item.saler_name}}</span></td>
                                <td>{{item.managename}}<br>
                                    <small>{{item.update_date}}</small>
                                </td>
                                <td>
                                    <button @mouseover="setpopper" class="btn btn-sm btn-default" data-toggle="popover" placement="right" title="支票详情">
                                        {{item.paytype_name}}
                                        <div class="content">
                                            <div style="width:25vw">
                                                <table class="table">
                                                    <tbody>
                                                    <tr>
                                                        <td width="25%">开票银行</td>
                                                        <td>{{item.bank_name}}</td>
                                                    </tr>
                                                    <tr>
                                                        <td>支票号</td>
                                                        <td>{{item.number}} </td>
                                                    </tr>
                                                    <tr>
                                                        <td>支票署名</td>
                                                        <td>{{item.signature}}</td>
                                                    </tr>
                                                    <tr>
                                                        <td>付款日期</td>
                                                        <td>{{item.pay_day_date}}</td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </button>
                                </td>
                                <td align="right">{{formatUnit(item.amount,'BRL')}}<small class="unit">BRL</small></td>
                                <td>{{item.pay_day_date}}</td>
                                <td>{{item.got_name}}<br><small>{{item.got_date}}</small></td>
                                <td align="right">
                                    {in name="267" value="$Think.session.admin.auth_ids"}
                                    <button @click="accountuse(item.id,1)" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#checkin_modal">存入账户</button>
                                    {/in}
                                    {in name="268" value="$Think.session.admin.auth_ids"}
                                    <button @click="accountuse(item.id,2)" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#used_modal">使用</button>
                                    {/in}
                                </td>
                            </tr>
                            <tr style="text-align: center;" v-if="list.length==0">
                                <td colspan="10" class="no_date">{:strtoupper(lang('no_data'))}</td>
                            </tr>
                            </tbody>
                            <tfoot>
                            <tr>
                                <td colspan="14" align="right">
                                    列表金额合计: {{formatUnit(sumcount,'BRL')}}<small class="unit">BRL</small> /
                                    选择金额合计:  {{formatUnit(checkmoney,'BRL')}}<small class="unit">BRL</small>
                                </td>
                            </tr>
                            </tfoot>
                        </table>
                        <div class="row clearfix">
                            <div class="col-md-12 column">
                                <ul class="pagination" id="paginationone" v-show="list.length!=0">
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 已存入 -->
                <div class="tab-pane" id="checkin">
                    <div class="col-md-12">
                        <table class="table table-striped table-hover ntTable">
                            <thead>
                            <tr>
                                <th class="text-center"><input type="checkbox" @click="allsel"></th>
                                <th width="4%"> 订单号 </th>
                                <th class="sorting"> 公司 </th>
                                <th> 业务员 </th>
                                <th> 编辑 </th>
                                <th> 支票 </th>
                                <th class="sorting"> 金额 </th>
                                <th class="sorting" >付款日期</th>
                                <th> 签收 </th>
                                <th> 存入日期 </th>
                                <th> 存入账户 </th>
                                <th> 确认 </th>
                                <th> 操作 </th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr v-for="item in list" :key="item.id">
                                <td align="center"><input type="checkbox" @click="onesel(item.id,item.amount)"></td>
                                <td><span v-if="item.sale_id">{{formatUnit(item.sale_id,'ID')}}</span></td>
                                <td><span v-if="item.sale_id">{{item.company_name}}</span></td>
                                <td><span v-if="item.sale_id">{{item.saler_name}}</span></td>
                                <td>{{item.managename}}<br>
                                    <small>{{item.update_date}}</small>
                                </td>
                                <td>
                                    <button @mouseover="setpopper" class="btn btn-sm btn-default" data-toggle="popover" placement="right" title="支票详情">
                                        {{item.paytype_name}}
                                        <div class="content">
                                            <div style="width:25vw">
                                                <table class="table">
                                                    <tbody>
                                                    <tr>
                                                        <td width="25%">开票银行</td>
                                                        <td>{{item.bank_name}}</td>
                                                    </tr>
                                                    <tr>
                                                        <td>支票号</td>
                                                        <td>{{item.number}} </td>
                                                    </tr>
                                                    <tr>
                                                        <td>支票署名</td>
                                                        <td>{{item.signature}}</td>
                                                    </tr>
                                                    <tr>
                                                        <td>付款日期</td>
                                                        <td>{{item.pay_day_date}}</td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </button>
                                </td>
                                <td align="right"><span :class="item.class">{{formatUnit(item.amount,'BRL')}}</span><small class="unit">BRL</small></td>
                                <td>{{item.pay_day_date}}</td>
                                <td>{{item.got_name}}<br><small>{{item.got_date}}</small></td>
                                <td>{{item.checkin_date}}</td>
                                <td>
                                    {{item.accountnumber}} <br>
                                    {{item.accountname}}
                                </td>
                                <td>{{item.check_name}}<br><small :class="item.class">{{item.success_fail_date}}</small></td>
                                <td align="right">
                                    {in name="263" value="$Think.session.admin.auth_ids"}
                                    <!--没有确认才可以取消 显示的话只能是7天内的-->
                                    <button v-if="item.check_id==0 && item.sevenday==1" class="btn btn-sm btn-default" @click="btnquxiao(item.id,1)">取消</button>
                                    {/in}
                                </td>
                            </tr>
                            <tr style="text-align: center;" v-if="list.length==0">
                                <td colspan="13" class="no_date">{:strtoupper(lang('no_data'))}</td>
                            </tr>
                            </tbody>
                            <tfoot>
                            <tr>
                                <td colspan="14" align="right">
                                    列表金额合计: {{formatUnit(sumcount,'BRL')}}<small class="unit">BRL</small> /
                                    选择金额合计: {{formatUnit(checkmoney,'BRL')}}<small class="unit">BRL</small>
                                </td>
                            </tr>
                            </tfoot>
                        </table>
                        <div class="row clearfix">
                            <div class="col-md-12 column">
                                <ul class="pagination" id="paginationtwo" v-show="list.length!=0">
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 已使用 -->
                <div class="tab-pane" id="used">
                    <div class="col-md-12">
                        <table class="table table-striped table-hover ntTable">
                            <thead>
                            <tr>
                                <th class="text-center"><input type="checkbox" @click="allsel"></th>
                                <th width="4%"> 订单号 </th>
                                <th class="sorting"> 公司 </th>
                                <th> 业务员 </th>
                                <th> 编辑 </th>
                                <th> 支票 </th>
                                <th class="sorting"> 金额 </th>
                                <th class="sorting" >付款日期</th>
                                <th> 签收 </th>
                                <th> 使用日期 </th>
                                <th> 使用说明 </th>
                                <th> 确认 </th>
                                <th> 操作 </th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr v-for="item in list" :key="item.id">
                                <td align="center"><input type="checkbox" @click="onesel(item.id,item.amount)"></td>
                                <td><span v-if="item.sale_id">{{formatUnit(item.sale_id,'ID')}}</span></td>
                                <td><span v-if="item.sale_id">{{item.company_name}}</span></td>
                                <td><span v-if="item.sale_id">{{item.saler_name}}</span></td>
                                <td>{{item.managename}}<br>
                                    <small>{{item.update_date}}</small>
                                </td>
                                <td>
                                    <button @mouseover="setpopper" class="btn btn-sm btn-default" data-toggle="popover" placement="right" title="支票详情">
                                        {{item.paytype_name}}
                                        <div class="content">
                                            <div style="width:25vw">
                                                <table class="table">
                                                    <tbody>
                                                    <tr>
                                                        <td width="25%">开票银行</td>
                                                        <td>{{item.bank_name}}</td>
                                                    </tr>
                                                    <tr>
                                                        <td>支票号</td>
                                                        <td>{{item.number}} </td>
                                                    </tr>
                                                    <tr>
                                                        <td>支票署名</td>
                                                        <td>{{item.signature}}</td>
                                                    </tr>
                                                    <tr>
                                                        <td>付款日期</td>
                                                        <td>{{item.pay_day_date}}</td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </button>
                                </td>
                                <td align="right"><span :class="item.class">{{formatUnit(item.amount,'BRL')}}</span><small class="unit">BRL</small></td>
                                <td>{{item.pay_day_date}}</td>
                                <td>{{item.got_name}}<br><small>{{item.got_date}}</small></td>
                                <td>{{item.used_date}}</td>
                                <td>
                                    {{item.remark}} <br>
                                </td>
                                <td>{{item.check_name}}<br><small :class="item.class">{{item.success_fail_date}}</small></td>
                                <td align="right">
                                    <!--没有确认才可以取消 并且显示的话，只能显示7天-->
                                    {in name="264" value="$Think.session.admin.auth_ids"}
                                    <button v-if="item.check_id==0 && item.sevendays==1" class="btn btn-sm btn-default" @click="btnquxiao(item.id,2)">取消</button>
                                    {/in}
                                    {in name="265" value="$Think.session.admin.auth_ids"}
                                    <button v-if="item.used_day>0 && item.success_at==0" @click="btnquxiao(item.id,3)" class="btn btn-sm btn-primary">确认</button>
                                    {/in}
                                    {in name="266" value="$Think.session.admin.auth_ids"}
                                    <button v-if="item.used_day>0 && item.fail_at==0" @click="btnquxiao(item.id,4)" class="btn btn-sm btn-warning">退票</button>
                                    {/in}
                                </td>
                            </tr>
                            <tr style="text-align: center;" v-if="list.length==0">
                                <td colspan="13" class="no_date">{:strtoupper(lang('no_data'))}</td>
                            </tr>
                            </tbody>
                            <tfoot>
                            <tr>
                                <td colspan="14" align="right">
                                    列表金额合计: {{formatUnit(sumcount,'BRL')}}<small class="unit">BRL</small> /
                                    选择金额合计: {{formatUnit(checkmoney,'BRL')}}<small class="unit">BRL</small>
                                </td>
                            </tr>
                            </tfoot>
                        </table>
                        <div class="row clearfix">
                            <div class="col-md-12 column">
                                <ul class="pagination" id="paginationthree" v-show="list.length!=0">
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>

            </div>

        </div>
    </div>
    <!-- 支票存入账户登记 开始 -->
    <div class="modal fade" id="checkin_modal" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-lg" style="width:80%">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">支票存入账户登记</h4>
                </div>
                <div class="modal-body">
                    <div class="row clearfix">
                        <div class="col-md-12 column">
                            <div class="alert alert-dismissable alert-info">
                                <button type="button" class="close">×</button>
                                <p></p>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <dir class="col-md-12">
                            <div class="div-scroll" style="max-height:40vh">
                                <table class="table table-striped table-hover ntTable">
                                    <thead>
                                    <tr>
                                        <th width="30%">公司</th>
                                        <th>支票号</th>
                                        <th>署名</th>
                                        <th>付款日期</th>
                                        <th>金额</th>
                                        <th>签收人</th>
                                        <th>签收时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr v-for="item in btndata.topdata" :key="item.id">
                                        <td><span v-if="item.sale_id">{{item.company_name}}</span></td>
                                        <td>{{item.number}}</td>
                                        <td>{{item.signature}}</td>
                                        <td>{{item.pay_day_date}}</td>
                                        <td align="right">{{formatUnit(item.amount,'BRL')}}<small class="unit">BRL</small></td>
                                        <td>{{item.got_name}}</td>
                                        <td>{{item.got_date}}</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </dir>
                        <dir class="col-md-4">
                            <table class="table">
                                <tbody>
                                    <tr>
                                        <td>合计</td>
                                        <td align="right">{{formatUnit(btndata.summoney,'BRL')}}<small class="unit">BRL</small></td>
                                    </tr>
                                    <tr>
                                        <td>张数</td>
                                        <td align="right">{{btndata.count}}<small class="unit">P</small></td>
                                    </tr>
                                </tbody>
                            </table>
                        </dir>
                        <div class="col-md-8">
                            <label for="checkin_to">存入账户</label>
                            <select name="" id="checkin_to" class="form-control" v-model="account_id" v-cloak>
                                <option value="">{:lang('please_select')}</option>
                                <option :value="item.id" v-for="(item,key) in btndata.accounts">
                                    {{item.name}}/{{item.bankname}}/{{item.account_num}}
                                </option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span>取消</button>
                    <button type="button" @click="savebtn(1)" class="btn btn-primary" style="padding-left:24px;padding-right:24px">
                        <span class="fa fa-check"></span> 确认存入账户
                    </button>
                </div>
            </div>
        </div>
    </div>
    <!-- 支票使用登记 开始 -->
    <div class="modal fade" id="used_modal" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-lg" style="width:80%">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">支票使用登记</h4>
                </div>
                <div class="modal-body">
                    <div class="row clearfix">
                        <div class="col-md-12 column">
                            <div class="alert alert-dismissable alert-info">
                                <button type="button" class="close">×</button>
                                <p></p>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <dir class="col-md-12">
                            <div class="div-scroll" style="max-height:40vh">
                                <table class="table table-striped table-hover ntTable">
                                    <thead>
                                    <tr>
                                        <th width="30%">公司</th>
                                        <th>支票号</th>
                                        <th>署名</th>
                                        <th>付款日期</th>
                                        <th>金额</th>
                                        <th>签收人</th>
                                        <th>签收时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr v-for="item in btndata.topdata" :key="item.id">
                                        <td><span v-if="item.sale_id">{{item.company_name}}</span></td>
                                        <td>{{item.number}}</td>
                                        <td>{{item.signature}}</td>
                                        <td>{{item.pay_day_date}}</td>
                                        <td align="right">{{formatUnit(item.amount,'BRL')}}<small class="unit">BRL</small></td>
                                        <td>{{item.got_name}}</td>
                                        <td>{{item.got_date}}</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </dir>
                        <dir class="col-md-4">
                            <table class="table">
                                <tbody>
                                    <tr>
                                        <td>合计</td>
                                        <td align="right">{{btndata.summoney}}<small class="unit">BRL</small></td>
                                    </tr>
                                    <tr>
                                        <td>张数</td>
                                        <td align="right">{{btndata.count}}<small class="unit">P</small></td>
                                    </tr>
                                </tbody>
                            </table>
                        </dir>
                        <div class="col-md-8">
                            使用说明
                            <textarea v-model="textremark" name="" id="" class="form-control" style="height:10vh"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span>取消</button>
                    <button type="button" @click="savebtn(2)" class="btn btn-primary" style="padding-left:24px;padding-right:24px">
                        <span class="fa fa-check"></span> 确认使用
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/foot"/}

<!--弹窗部分 结束-->
<script>
    var table = new Vue({
        el: '#chequeuser',
        data: {
            list: [],
            status: '1',
            page: '1',
            pageSize: 30,
            btndata: {
                summoney:0,
                count:0,
                topdata:{},
                accounts:[],
            },
            countnum: {
                countnumone: '',
                countnumtwo: '',
                countnumthree: '',
            },
            batch:[],//选中的值
            allid: [],//当前页ids
            checkmoney: 0,//选中的金额
            sumcount:0,//列表合计金额
            account_id:'',//存入账号
            textremark:''//使用说明
        },
        methods: {
            formatUnit: formatUnit,
            setPage(pageCurrent, pageSum, pagination) {
                //数据总条数
                var myPageCount = pageSum;
                //一页显示多少条
                var myPageSize = this.pageSize;
                //总页数
                var countindex = myPageCount % myPageSize > 0 ? (myPageCount / myPageSize) + 1 : (myPageCount / myPageSize);
                $.jqPaginator(pagination, {
                    totalPages: parseInt(countindex),
                    //最多显示多少页
                    visiblePages: 5,
                    //默认显示第几页
                    currentPage: pageCurrent,
                    first: '<li class="first"><a href="javascript:;">' + langcon.page_home + '</a></li>',
                    prev: '<li class="prev"><a href="javascript:;"><i class="arrow arrow2"></i>' + langcon.previous_page + '</a></li>',
                    next: '<li class="next"><a href="javascript:;">' + langcon.next_page + '<i class="arrow arrow3"></i></a></li>',
                    last: '<li class="last"><a href="javascript:;">' + langcon.last_page + '</a></li>',
                    page: '<li class="page"><a href="javascript:;">{{page}}</a></li>',
                    all: '<li class="page"><a href="javascript:;">' + myPageCount + ' / ' + this.page + 'PG , ' + this.pageSize + ' /PG</a></li>',
                    onPageChange: (num, type) => {
                        if (type == "change") {
                            this.page = num
                            this.getAllList()
                        }
                    }
                });
            },
            //数据所有获取
            getAllList(){
                $('.loding').show();
                $.ajax({
                    url: "/admin/finance/list2cheque",
                    type: 'post',
                    data: {
                        status: this.status,//页面标签
                        getdata: '',//获取标志
                        page: this.page,
                        pageSize: this.pageSize,
                    },
                    dataType: "json",
                    success: (result) => {
                        $('.loding').hide();
                        //重置相关的值
                        this.checkmoney= this.sumcount=0;
                        this.batch=this.allid=[];
                        let arr = [];
                        result.data.forEach(item => {
                            let index = $.inArray(item.sale_id, arr);
                            if (index >= 0) {
                                item.sale_id = '';
                            }
                            arr.push(item.sale_id);
                            //列表金额合计
                           this.sumcount+=item.amount;
                        });
                        this.list = result.data;
                        this.countnum.countnumone = result.arrcount.one;
                        this.countnum.countnumtwo = result.arrcount.two;
                        this.countnum.countnumthree = result.arrcount.three;
                        this.allid=result.ids;
                        let pagination = '';
                        if (this.status == 1) {
                            pagination = '#paginationone';
                        } else if (this.status == 2) {
                            pagination = '#paginationtwo';
                        } else if (this.status == 3) {
                            pagination = '#paginationthree';
                        }
                        if (result.count) {
                            $('.loding').hide()
                            this.setPage(parseInt(this.page), result.count, pagination)
                        }
                    }
                })
            },
            //标签切换
            changestatus(status){
                this.status = status;
                this.getAllList()
            },
            //隐藏需要隐藏的部分
            datapopover(){
                $.each($("[data-toggle='popover']"), (key, value) => {
                    $(value).find(".content").hide();

                })
            },
            //设置popper组件的配置
            setpopper(e){
                $(e.target).popover({
                    trigger: 'hover focus manual',
                    placement: ($(e.target).attr("placement") == undefined) ? 'left' : $(e.target).attr("placement"),
                    //placement:'left',
                    title: $(e.target).attr("title"),
                    html: 'true',
                    content: $(e.target).find(".content").html(),
                    animation: false
                });
            },
            //对数据进行保存
            savebtn(code){
                $.ajax({
                        url: "/admin/finance/list2cheque",
                        type: 'post',
                        data: {
                            code,
                            account_id:this.account_id,
                            textremark:this.textremark,
                            savebtn:'',
                            datatop:this.btndata.topdata
                        },
                        dataType: "json",
                        success: (result) => {
                            if (result.status != 1) {
                                change_mes_type('.modal-body .alert', result.status)
                                $('.modal-body .alert').show()
                                $('.modal-body .alert p').html('*' + result.msg + '<br>')
                            } else {
                                if (result.status == 1) {
                                    this.getAllList();
                                    this.textremark='';
                                    this.account_id='';
                                }
                                change_mes_type('#headeralert', result.status)
                                $('#headeralert').show()
                                $('#headeralert p').html('*' + result.msg + '<br>')
                                if(code==1){
                                    $('#checkin_modal').modal('toggle')
                                }else {
                                    $('#used_modal').modal('toggle')
                                }
                            }
                        }
                    })
            },
            onesel(id,money){
                if (this.batch.indexOf(id) == -1) {
                    this.batch.push(id);
                    this.checkmoney += money//选中的金额
                } else {
                    this.batch.splice(this.batch.indexOf(id), 1);
                    this.checkmoney -= money//选中的金额
                }
                var isall = true
                $('td input').each(function () {
                    if (!$(this).prop('checked')) {
                        isall = false
                    }
                })
                $('th input').prop('checked', isall)
            },
            //全选
            allsel(event){
                if ($(event.target).prop('checked')) {
                    $(event.target).parents('table').find('input').prop('checked', true)
                    this.batch = this.allid
                    this.checkmoney=this.sumcount//选中金额和合计金额一样
                } else {
                    $(event.target).parents('table').find('input').prop('checked', false)
                    this.batch = [];
                    this.checkmoney=0;//选中金额为0
                }
            },
            //已存入 已使用 的取消 确认和退票
            btnquxiao(id,code){
                var huifuquxiao='';
                if(code==1){
                    //已存入取消
                    huifuquxiao='chequequxiao';
                }else if(code==2) {
                    //已使用中的取消
                    huifuquxiao='chequequxiaos'
                }else if(code==3){
                    //已使用中的确认
                    huifuquxiao='chequequeren'
                }else if(code==4){
                    //已使用中的退票
                    huifuquxiao='chequequerens'
                }
                $.ajax({
                    url: "/admin/finance/"+huifuquxiao,
                    type: 'post',
                    data: {
                        id
                    },
                    success: (result) => {
                        data = JSON.parse(result)
                        change_mes_type('#headeralert', data.status)
                        $('#headeralert').show()
                        $('#headeralert p').html(data.msg)
                        if (data.status == 1) {
                            this.getAllList()
                        }
                    }
                })
            },
            //存入账户 使用点击 批量存入账户 批量使用
            accountuse(id,code){
                this.account_id='';//清空存入账号
                var requesturl=''
                if(code==1){
                    //存入账户
                    requesturl='accountcheque';
                }else if(code=2){
                    //使用
                    requesturl='usecheque';
                }
                $.ajax({
                    url: "/admin/finance/"+requesturl,
                    type: 'post',
                    data: {
                        id,
                        code,
                    },
                    dataType: "json",
                    success: (result) => {
                        this.btndata.topdata = result.topdata//头部数据
                        this.btndata.summoney = result.summoney//合计金额
                        this.btndata.count = result.count;//张数
                        this.btndata.accounts = result.accounts;//存入账号
                    }
                })
            },
            //点击批量存入账户和批量使用
            openRUcang(code){
                    if(this.batch.length==0){
                        change_mes_type('#headeralert', 2)
                        $('#headeralert').show()
                        $('#headeralert p').html('*请选择要勾选支票<br>')
                    }else {
                        if(code==1){
                            //批量存入账户
                            this.accountuse(this.batch.toString(),'1')
                            $('#checkin_modal').modal('show')
                        }else {
                            //批量使用
                            this.accountuse(this.batch.toString(),'2')
                            $('#used_modal').modal('show')
                        }
                    }
                }
            },
        created(){
            this.getAllList();//数据
            this.datapopover();//插件
        },
        mounted(){
            //存入账户清空提示
            $('#checkin_modal').on('hide.bs.modal', (el) => {
                //清掉提示的内容
                $('.modal-body .alert').hide()
                $('.modal-body .alert p').html()
                $('#checkin_modal').removeData('bs.modal');
                $(document).unbind('keydown');
            });
        }
    })
</script>